package com.nuc.edu.user.controller;

import com.nuc.edu.framework.web.controller.BaseController;
import com.nuc.edu.framework.web.page.TableDataInfo;
import com.nuc.edu.project.system.notice.domain.Notice;
import com.nuc.edu.project.system.user.domain.User;
import com.nuc.edu.project.system.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author rrbai
 */
@Controller
public class UserReservationController extends BaseController {
    @Autowired
    private IUserService userService;

    /**
     * 服务详情列表
     */
    @RequestMapping("service_detail")
    public String userServiceDetail(Model model, @RequestParam String serviceName){
        model.addAttribute("serviceName", serviceName);
        return "user_service_list";
    }

    @RequestMapping("service_list/{serviceName}")
    @ResponseBody
    public TableDataInfo userServiceList(@PathVariable String serviceName){
        User user = new User();
        user.setPostNames(serviceName);
        startPage();
        List<User> list = userService.selectUserList(user);
        return getDataTable(list);
    }
}
